<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>实时显示时间</title>
    <script>
        window.onload = function (){
            setInterval(refresh,1000);
        }
        function refresh(){
            document.getElementById("date_1").innerText = new Date().toLocaleString();
        }
    </script>
</head>
<body>
    <h1 id="date_1" align="center"></h1>
</body>
</html>